package com.heima.xianchengchi;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MyExecutor02 {
    public static void main(String[] args) throws InterruptedException {
        //newFixedThreadPool()可容纳最大值，newFixedThreadPool是空的，（）面是最大值
        //参数不是初始值而是最大值
        ExecutorService executorService = Executors.newFixedThreadPool(1);
        executorService.submit(() -> {
            System.out.println(Thread.currentThread().getName() + "执行了");
        });
        Thread.sleep(1000);
        executorService.submit(() -> {
            System.out.println(Thread.currentThread().getName() + "执行了");
        });
        executorService.shutdown();

    }
}
